home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / pas_0493.zip / EXEHDR.TXT < prev    next >
Text File  |  1993-04-14  |  4KB  |  83 lines

  1. {─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
  2. Msg  : 275 of 298                                                               
  3. From : Amir Geva                           2:403/138.0          04 Apr 93  01:02 
  4. To   : Eric Ort                                                                  
  5. Subj : " .EXE " File Headers...                                               
  6. ────────────────────────────────────────────────────────────────────────────────
  7. Hi.
  8.  
  9.  EO> Could anyone out there tell me how to read in a .EXE File Header, so
  10.  EO> I can manipulate a program based on the info therein ??  }
  11.  
  12. =====================================================================
  13. ==                 The format of an EXE load module.               ==
  14. =====================================================================
  15.  
  16.  Byte
  17. Offset
  18.  
  19. 0000H        First part of EXE file signature (4DH)
  20. 0001H        Seconed part of EXE signature (5AH)
  21. 0002H        Length of file MOD 512
  22. 0004H        Size of file in 512-byte pages, including header
  23. 0006H        Number of relocation table items
  24. 0008H        Size of header in paragraphs
  25. 000AH        Minimum number of paragraphs needed above program
  26. 000CH        Maximum number of paragraphs desired above program
  27. 000EH        Segment displacement of stack module
  28. 0010H        Contents of SP register at entry
  29. 0012H        Word checksum
  30. 0014H        Contents of IP register at entry
  31. 0016H        Segment displacement of code module
  32. 0018H        Offset of first relocation item in file
  33. 001AH        Overlay number (0 for resident part of program)
  34. 001BH        Variable reserved space
  35.              .
  36.              .
  37.              Relocation table
  38.              .
  39.              .
  40.              Varible reserved space
  41.              .
  42.              .
  43.              .
  44.              Program and data segments
  45.              .
  46.              .
  47.              .
  48.              .
  49.              Stack segment
  50.              .
  51.  
  52.              .
  53. =====================================================================
  54. =====================================================================
  55. ==      A memory image of a typical EXE file just after loading    ==
  56. =====================================================================
  57.  
  58.                 +---------------------------------------+ SS:SP
  59.                 |                                       |
  60.                 |       Stack segment: stack grows      |
  61.                 |      downward from top of segment     |
  62.                 |                                       |
  63.                 +---------------------------------------+ SS:0000H
  64.                 |                                       |
  65.                 |             Data Segemnt              |
  66.                 |                                       |
  67.                 +---------------------------------------+
  68.                 |                                       |
  69.                 |                                       |
  70.                 |             Program Code              |
  71.                 |                                       |
  72.                 |                                       |
  73.                 +---------------------------------------+ CS:0000H
  74.                 |                                       |
  75.                 |        Program Segment Prefix         |
  76.                 |                                       |
  77.                 +---------------------------------------+ DS:0000H
  78.  
  79.  
  80. bye
  81.  
  82.                 Amir @ 2:401/450
  83.